home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / s_to_z / vpe_130 / delphi / vpengine.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  18.0 KB  |  518 lines

  1. unit VPENGINE;
  2.  
  3. interface
  4.  
  5. Uses WinTypes, WinProcs
  6. {$IFDEF VER80}
  7.        ,Messages;     {Units for Delphi}
  8. {$ELSE}
  9.      ;
  10. {$ENDIF}
  11.  
  12. {/// }
  13. {/// VPECOMON.H }
  14. {/// ========== }
  15. {/// }
  16. {/// Common definitions for the "Virtual Print Engine" }
  17. {/// }
  18. {/// 01/95 by IDEAL Software, T. Radde }
  19. {/// }
  20.  
  21. {/// VpeOpenDoc() Flag Parameters: }
  22. {/// ============================= }
  23. Const VPE_GRID_INBACKGROUND = 1; {// Grid in Background}
  24.       VPE_GRID_INFOREGROUND = 2; {// Grid in Foreground}
  25.       VPE_GRID_TOOLBARBUTTON = 4; {// Grid Toolbar-Button visible}
  26.       VPE_GRID_VISIBLE = 8; {// Actually Grid visible}
  27.  
  28.       VPE_NO_RULER = 16; {// Ruler NOT visible}
  29.       VPE_NO_TOOLBAR = 32; {// Toolbar NOT visible}
  30.       VPE_NO_USER_CLOSE = 64; {// User can't close VPE -}
  31.                               {/// Stop-Button INVISIBLE and Sys-Menu }
  32.                               {/// disabled (if not embedded) }
  33.                               {/// VpeCloseDoc() works! }
  34.       VPE_NO_USER_MOVE = 128; {// User can't leaf through the document}
  35.                               {/// in future: then no Page-Seg in Statusbar }
  36.       VPE_NO_MOUSE_SCALE = 256; {// User can't scale with the MOUSE (VpeSetScale() works!)}
  37.       VPE_NO_USER_SCALE = (512 or VPE_NO_MOUSE_SCALE); {// User can't scale (VpeSetScale() works!)}
  38.                               {/// in future: then no Scale-Seg in Statusbar }
  39.  
  40.       VPE_NO_STATBAR = 1024; {// Statusbar invisible}
  41.  
  42.       VPE_NO_PRINTBUTTON = 2048; {// Print-Button invisible}
  43.                                  {/// VpePrintDoc() works }
  44.  
  45.       VPE_EMBEDDED = 4096; {// Document Window is embedded within}
  46.                            {/// a window of the calling application }
  47.       VPE_LANDSCAPE = 8192; {// Document will be printed in Landscape-Format}
  48.       VPE_MEMORY_SWAP = 16384; {// Each page is swapped to a temporary file, so that}
  49.                                {/// only one page is held in memory (NOT implemented yet!) }
  50.       VPE_NO_HELPBTN = 32768; {// Help-Button invisible}
  51.       VPE_ROUTE_HELP = 65536; {// if Help-Button visible, pressing this or pushing the F1-key}
  52.                               {/// will cause the message VPE_HELP to be send to the owner-window, }
  53.                               {/// no matter if the VPE-window is embedded or not }
  54.       VPE_NO_INFOBTN = 131072; {// Info-Button invisible}
  55.  
  56.       VPE_GRID_POSSIBLE = (VPE_GRID_INFOREGROUND or VPE_GRID_TOOLBARBUTTON);
  57.       VPE_GRID_ON = (VPE_GRID_INFOREGROUND or VPE_GRID_TOOLBARBUTTON or VPE_GRID_VISIBLE);
  58.       VPE_GRID_BKGON = (VPE_GRID_INBACKGROUND or VPE_GRID_TOOLBARBUTTON or VPE_GRID_VISIBLE);
  59.       VPE_GRID_OFF = 0;
  60.  
  61. {/// VpePreviewDoc() Flag Parameters: }
  62. {/// =============================== }
  63.       VPE_SHOW_NORMAL = 1;
  64.       VPE_SHOW_MAXIMIZED = 2;
  65.       VPE_SHOW_HIDE = 3;
  66.  
  67. {/// Text-Formatting Attributes: }
  68. {/// =========================== }
  69.       ALIGN_LEFT = 0;
  70.       ALIGN_RIGHT = 1;
  71.       ALIGN_CENTER = 2;
  72.       ALIGN_JUSTIFIED = 3;
  73.       ALIGN_PRINT = 4;
  74.  
  75. {/// Frame Attributes: }
  76. {/// ================= }
  77.       FRAME_INSIDE = 0;
  78.       FRAME_OUTSIDE = 1;
  79.       FRAME_ONCENTER = 2;
  80.  
  81. {/// Picture Attributes: }
  82. {/// =================== }
  83.       VPE_PIC_MERGE = 1; {// merge background with bitmap (SRCAND instead of SRCCOPY)}
  84.       VPE_PIC_KEEPIMAGE = 2; {// The KEEP-Flags are only relevant when working with a preview.}
  85. {/// An image is the (uncompressed and sometimes huge) data in the file }
  86. {/// that is read into memory. A DIB is an image rendered to the device }
  87. {/// and another (sometimes huge) datablock. }
  88. {/// VPE does the following: }
  89. {/// On VpePicture() the whole image is read into memory and the the image-dimensions }
  90. {/// are calculated. Afterwards the image is immediately removed from memory. }
  91. {/// When the preview opens, and if the picture has to be drawn (LOOP), the image }
  92. {/// is read again into memory and then the DIB is rendered. }
  93. {/// Afterwards the image-data is immediately removed from memory, since only the }
  94. {/// DIB is needed to be displayed. }
  95. {/// The DIB is held in memory until the user moves to another page. }
  96. {/// When printing with the open preview, the DIB is removed, the image-data }
  97. {/// is read in and a new DIB is rendered to the capabilities of the new output device. }
  98. {/// After the DIB is printed, it is immediately removed from memory. }
  99. {/// The things then continue at "LOOP". }
  100. {/// This is the standard behaviour of VPE and a balance between execution speed }
  101. {/// and memory usage. }
  102. {/// So with the flag VPE_PIC_KEEPIMAGE the turn-around between displaying and }
  103. {/// printing will speed up. }
  104. {/// It is also useful, when having only one page (or multiple pages with small }
  105. {/// Bitmaps) in an open preview, since VPE reads the image-data twice }
  106. {/// (for getting the dimensions and then for displaying). }
  107.       VPE_PIC_DISCARD_DIB_DRAW = 4; {// VPE holds in a preview all DIB's in memory until the user moves to}
  108. {/// another page. Using this flag will discard the DIB immediately after drawing }
  109. {/// from memory }
  110.       VPE_PIC_KEEP_DIB_PAGE = 8; {// VPE discards in a preview all DIB's from memory when the user moves}
  111. {/// to another page. Using this flag will stop this mechanism. Also it overrides }
  112. {/// the VPE_PIC_DISCARD_DIB_DRAW flag. }
  113.  
  114.  
  115.  
  116.  
  117. {/// ======================================================================== }
  118. {/// Notification Messages: }
  119. {/// ======================================================================== }
  120.       VPE_DESTROYWINDOW = WM_USER + 2306;
  121.       VPE_PRINT = WM_USER + 2307;
  122.       VPE_PRINTCANCEL = WM_USER + 2308;
  123.       VPE_HELP = WM_USER + 2309;
  124.  
  125. {/// ======================================================================== }
  126. {/// Barcode Types: }
  127. {/// ======================================================================== }
  128.       BCT_EAN13 = 1;
  129.       BCT_EAN8 = 2;
  130.       BCT_UPCA = 3;
  131.       BCT_CODABAR = 5;
  132.       BCT_CODE39 = 6;
  133.       BCT_2OF5 = 7;
  134.       BCT_INTERLEAVED2OF5 = 8;
  135.       BCT_UPCE = 9;
  136.       BCT_EAN13_2 = 10;
  137.       BCT_EAN13_5 = 11;
  138.       BCT_EAN8_2 = 12;
  139.       BCT_EAN8_5 = 13;
  140.       BCT_UPCA_2 = 14;
  141.       BCT_UPCA_5 = 15;
  142.       BCT_UPCE_2 = 16;
  143.       BCT_UPCE_5 = 17;
  144.       BCT_EAN128A = 18;
  145.       BCT_EAN128B = 19;
  146.       BCT_EAN128C = 20;
  147.       BCT_CODE93 = 21;
  148.       BCT_POSTNET = 22;
  149.  
  150. {/// ======================================================================== }
  151. {/// Positioning Codes: }
  152. {/// ======================================================================== }
  153.       VFREE = -1;
  154.       VLEFT = -2;
  155.       VRIGHT = -3;
  156.       VLEFTMARGIN = -4;
  157.       VRIGHTMARGIN = -5;
  158.       VTOP = -6;
  159.       VBOTTOM = -7;
  160.       VTOPMARGIN = -8;
  161.       VBOTTOMMARGIN = -9;
  162.  
  163. {/// }
  164. {/// VPIFACE.H }
  165. {/// ========= }
  166. {/// }
  167. {/// The DLL-Interface for the "Virtual Print Engine". }
  168. {/// }
  169. {/// To be used by the calling applications. }
  170. {/// }
  171. {/// external Macro-Definitions: }
  172. {/// WINDOWS_DLL generates Windows DLL-Code, else Windows static library }
  173. {/// }
  174. {/// 11/94 by IDEAL Software, T. Radde }
  175. {/// }
  176.  
  177. function VpeGetVersion: Integer;
  178.  
  179. function VpeOpenDoc(hWndParent: HWND;
  180.                     title: PChar;
  181.                     page_width: Integer;
  182.                     page_height: Integer;
  183.                     flags: LongInt): LongInt;
  184.  
  185. function VpeCloseDoc(hDoc: LongInt): Integer; 
  186.  
  187. function VpeWindowHandle(hDoc: LongInt): HWND;
  188.  
  189. procedure VpeSetDefaultOutputRect(hDoc: LongInt; 
  190.                                   r: PRECT); 
  191.  
  192. procedure VpeSetOutputRect(hDoc: LongInt;
  193.                            r: PRECT); 
  194.  
  195. procedure VpeGetOutputRect(hDoc: LongInt; 
  196.                            r: PRECT); 
  197.  
  198. procedure VpeSetPosRect(hDoc: LongInt; 
  199.                         r: PRECT); 
  200.  
  201. procedure VpeGetPosRect(hDoc: LongInt; 
  202.                         r: PRECT); 
  203.  
  204. procedure VpeSet(hDoc: LongInt; 
  205.                  what: Integer; 
  206.                  value: Integer); 
  207.  
  208. function VpeGet(hDoc: LongInt; 
  209.                 what: Integer): Integer; 
  210.  
  211. procedure VpeStorePos(hDoc: LongInt); 
  212.  
  213. procedure VpeRestorePos(hDoc: LongInt);
  214.  
  215. procedure VpeSetScale(hDoc: LongInt; 
  216.                       scale: Double); 
  217.  
  218. function VpeSetupPrinter(hDoc: LongInt;
  219.                          file_name: PChar; 
  220.                          dialog_control: Integer): Integer; 
  221.  
  222. procedure VpePrintDoc(hDoc: LongInt; 
  223.                       with_setup: Bool); 
  224.  
  225. function VpeIsPrinting(hDoc: LongInt): Integer; 
  226.  
  227. procedure VpePreviewDoc(hDoc: LongInt; 
  228.                         rc: PRECT; 
  229.                         show_hide: Integer); 
  230.  
  231. procedure VpeSetUpdate(hDoc: LongInt; 
  232.                        yes_no: Integer); 
  233.  
  234. procedure VpeRefreshDoc(h: LongInt); 
  235.  
  236. procedure VpeSetPen(hDoc: LongInt; 
  237.                     pen_size: Integer; 
  238.                     pen_style: Integer; 
  239.                     color: TColorRef);
  240.  
  241. procedure VpeNoPen(hDoc: LongInt); 
  242.  
  243. procedure VpeLine(hDoc: LongInt; 
  244.                   x: Integer;
  245.                   y: Integer; 
  246.                   x2: Integer; 
  247.                   y2: Integer); 
  248.  
  249. function VpePolyLine(h: LongInt; 
  250.                      p: LongInt;
  251.                      size: Word): LongInt; 
  252.  
  253. procedure VpeAddPolyPoint(h: LongInt; 
  254.                           p: LongInt; 
  255.                           x: Integer; 
  256.                           y: Integer); 
  257.  
  258. procedure VpeSetBkgColor(hDoc: LongInt; 
  259.                          color: TColorRef); 
  260.  
  261. procedure VpeSetTransparentMode(hDoc: LongInt; 
  262.                                 on_off: Integer); 
  263.  
  264. procedure VpeBox(hDoc: LongInt; 
  265.                  x: Integer;
  266.                  y: Integer; 
  267.                  x2: Integer; 
  268.                  y2: Integer); 
  269.  
  270. procedure VpeSetBarcodeParms(hdoc: LongInt;
  271.                              orientation: Integer; 
  272.                              top_bottom: BYTE; 
  273.                              add_top_bottom: BYTE); 
  274.  
  275. procedure VpeBarcode(h: LongInt; 
  276.                      x: Integer; 
  277.                      y: Integer; 
  278.                      x2: Integer; 
  279.                      y2: Integer; 
  280.                      code_type: Integer; 
  281.                      code: PChar; 
  282.                      add_code: PChar); 
  283.  
  284. procedure VpeKeepBitmapAspect(hdoc: LongInt; 
  285.                               on_off: Integer); 
  286.  
  287. procedure VpeDefaultBitmapDPI(hdoc: LongInt; 
  288.                               dpix: Integer; 
  289.                               dpiy: Integer); 
  290.  
  291. function VpeGetPictureTypes(with_filters: Bool): PChar;
  292.  
  293. procedure VpePicture(hDoc: LongInt; 
  294.                      x: Integer; 
  295.                      y: Integer; 
  296.                      x2: Integer;
  297.                      y2: Integer; 
  298.                      file_name: PChar; 
  299.                      flags: Integer); 
  300.  
  301. procedure VpeSelectFont(hDoc: LongInt; 
  302.                         name: PChar; 
  303.                         size: Integer); 
  304.  
  305. procedure VpeSetFontAttr(hDoc: LongInt; 
  306.                          alignment: Integer; 
  307.                          bold: Integer; 
  308.                          underlined: Integer; 
  309.                          italic: Integer); 
  310.  
  311. procedure VpeSetAlign(hDoc: LongInt; 
  312.                       alignment: Integer); 
  313.  
  314. procedure VpeSetBold(hDoc: LongInt; 
  315.                      bold: Integer); 
  316.  
  317. procedure VpeSetUnderlined(hDoc: LongInt; 
  318.                            underlined: Integer); 
  319.  
  320. procedure VpeSetItalic(hDoc: LongInt; 
  321.                        italic: Integer); 
  322.  
  323. procedure VpeSetTextColor(hdoc: LongInt; 
  324.                           color: TColorRef); 
  325.  
  326. function VpePrint(h: LongInt; 
  327.                   x: Integer; 
  328.                   y: Integer; 
  329.                   s: PChar): Integer; 
  330.  
  331. function VpePrintBox(h: LongInt; 
  332.                      x: Integer; 
  333.                      y: Integer; 
  334.                      s: PChar): Integer; 
  335.  
  336. function VpeWrite(h: LongInt; 
  337.                   x: Integer; 
  338.                   y: Integer; 
  339.                   x2: Integer; 
  340.                   y2: Integer; 
  341.                   s: PChar): Integer; 
  342.  
  343. function VpeWriteBox(hDoc: LongInt; 
  344.                      x: Integer; 
  345.                      y: Integer; 
  346.                      x2: Integer; 
  347.                      y2: Integer; 
  348.                      s: PChar): Integer;
  349.  
  350. procedure VpeDefineHeader(hDoc: LongInt; 
  351.                           x: Integer; 
  352.                           y: Integer; 
  353.                           x2: Integer; 
  354.                           y2: Integer; 
  355.                           s: PChar); 
  356.  
  357. procedure VpeDefineFooter(hDoc: LongInt; 
  358.                           x: Integer; 
  359.                           y: Integer; 
  360.                           x2: Integer; 
  361.                           y2: Integer; 
  362.                           s: PChar); 
  363.  
  364. procedure VpePageBreak(hDoc: LongInt); 
  365.  
  366. function VpeGetPageCount(hdoc: LongInt): Integer; 
  367.  
  368. function VpeGetCurrentPage(hDoc: LongInt): Integer; 
  369.  
  370. procedure VpeGotoPage(hDoc: LongInt; 
  371.                       page: Integer); 
  372.  
  373. procedure VpeStoreSet(hDoc: LongInt; 
  374.                       id: Integer);
  375.  
  376. procedure VpeUseSet(hDoc: LongInt; 
  377.                     id: Integer); 
  378.  
  379. procedure VpeRemoveSet(hDoc: LongInt; 
  380.                        id: Integer); 
  381.  
  382. procedure VpeTplCreatePage(h: LongInt; 
  383.                            id: Integer); 
  384.  
  385. procedure VpeTplCreateEnd(h: LongInt); 
  386.  
  387. procedure VpeTplUse(h: LongInt; 
  388.                     id: Integer; 
  389.                     x: Integer; 
  390.                     y: Integer); 
  391.  
  392. procedure VpeTplUseEnd(h: LongInt);
  393.  
  394. function VpeOpenDocFile(hWndParent: HWND;
  395.                         file_name: PChar;
  396.                         title: PChar;
  397.                         page_width: Integer;
  398.                         page_height: Integer;
  399.                         flags: LongInt): LongInt;
  400.  
  401. procedure VpeSetRulersMeasure(hDoc: LongInt;
  402.                               rulers_measure: integer);
  403.  
  404. var
  405.    COLOR_BLACK : longint;
  406.    COLOR_DKGRAY : longint;
  407.    COLOR_GRAY : longint;
  408.    COLOR_LTGRAY : longint;
  409.    COLOR_WHITE : longint;
  410.    COLOR_DKRED : longint;
  411.    COLOR_RED : longint;
  412.    COLOR_LTRED : longint;
  413.    COLOR_DKGREEN : longint;
  414.    COLOR_GREEN : longint;
  415.    COLOR_LTGREEN : longint;
  416.    COLOR_BLUEGREEN : longint;
  417.    COLOR_OLIVE : longint;
  418.    COLOR_DKBLUE : longint;
  419.    COLOR_BLUE : longint;
  420.    COLOR_CYAN : longint;
  421.    COLOR_DKPURPLE : longint;
  422.    COLOR_PURPLE : longint;
  423.    COLOR_MAGENTA : longint;
  424.    COLOR_LTYELLOW : longint;
  425.  
  426. implementation
  427.  
  428. function VpeGetVersion; external 'VPENGINE';
  429. function VpeOpenDoc; external 'VPENGINE';
  430. function VpeCloseDoc; external 'VPENGINE';
  431. function VpeWindowHandle; external 'VPENGINE';
  432. procedure VpeSetDefaultOutputRect; external 'VPENGINE';
  433. procedure VpeSetOutputRect; external 'VPENGINE';
  434. procedure VpeGetOutputRect; external 'VPENGINE';
  435. procedure VpeSetPosRect; external 'VPENGINE';
  436. procedure VpeGetPosRect; external 'VPENGINE';
  437. procedure VpeSet; external 'VPENGINE';
  438. function VpeGet; external 'VPENGINE';
  439. procedure VpeStorePos; external 'VPENGINE';
  440. procedure VpeRestorePos; external 'VPENGINE';
  441. procedure VpeSetScale; external 'VPENGINE';
  442. function VpeSetupPrinter; external 'VPENGINE';
  443. procedure VpePrintDoc; external 'VPENGINE';
  444. function VpeIsPrinting; external 'VPENGINE';
  445. procedure VpePreviewDoc; external 'VPENGINE';
  446. procedure VpeSetUpdate; external 'VPENGINE';
  447. procedure VpeRefreshDoc; external 'VPENGINE';
  448. procedure VpeSetPen; external 'VPENGINE';
  449. procedure VpeNoPen; external 'VPENGINE';
  450. procedure VpeLine; external 'VPENGINE';
  451. function VpePolyLine; external 'VPENGINE';
  452. procedure VpeAddPolyPoint; external 'VPENGINE';
  453. procedure VpeSetBkgColor; external 'VPENGINE';
  454. procedure VpeSetTransparentMode; external 'VPENGINE';
  455. procedure VpeBox; external 'VPENGINE';
  456. procedure VpeSetBarcodeParms; external 'VPENGINE';
  457. procedure VpeBarcode; external 'VPENGINE';
  458. procedure VpeKeepBitmapAspect; external 'VPENGINE';
  459. procedure VpeDefaultBitmapDPI; external 'VPENGINE';
  460. function VpeGetPictureTypes; external 'VPENGINE';
  461. procedure VpePicture; external 'VPENGINE';
  462. procedure VpeSelectFont; external 'VPENGINE';
  463. procedure VpeSetFontAttr; external 'VPENGINE';
  464. procedure VpeSetAlign; external 'VPENGINE';
  465. procedure VpeSetBold; external 'VPENGINE';
  466. procedure VpeSetUnderlined; external 'VPENGINE';
  467. procedure VpeSetItalic; external 'VPENGINE';
  468. procedure VpeSetTextColor; external 'VPENGINE';
  469. function VpePrint; external 'VPENGINE';
  470. function VpePrintBox; external 'VPENGINE';
  471. function VpeWrite; external 'VPENGINE';
  472. function VpeWriteBox; external 'VPENGINE';
  473. procedure VpeDefineHeader; external 'VPENGINE';
  474. procedure VpeDefineFooter; external 'VPENGINE';
  475. procedure VpePageBreak; external 'VPENGINE';
  476. function VpeGetPageCount; external 'VPENGINE';
  477. function VpeGetCurrentPage; external 'VPENGINE';
  478. procedure VpeGotoPage; external 'VPENGINE';
  479. procedure VpeStoreSet; external 'VPENGINE';
  480. procedure VpeUseSet; external 'VPENGINE';
  481. procedure VpeRemoveSet; external 'VPENGINE';
  482. procedure VpeTplCreatePage; external 'VPENGINE';
  483. procedure VpeTplCreateEnd; external 'VPENGINE';
  484. procedure VpeTplUse; external 'VPENGINE';
  485. procedure VpeTplUseEnd; external 'VPENGINE';
  486. function VpeOpenDocFile; external 'VPENGINE';
  487. procedure VpeSetRulersMeasure; external 'VPENGINE';
  488.  
  489. {$IFDEF VER80}
  490. initialization
  491. {$ELSE}
  492. begin
  493. {$ENDIF}
  494. {/// ========================================================================= }
  495. {/// Color-Definitions }
  496. {/// ========================================================================= }
  497.    COLOR_BLACK := RGB(0, 0, 0);
  498.    COLOR_DKGRAY := RGB(128, 128, 128);
  499.    COLOR_GRAY := RGB(192, 192, 192);
  500.    COLOR_LTGRAY := RGB(230, 230, 230);
  501.    COLOR_WHITE := RGB(255, 255, 255);
  502.    COLOR_DKRED := RGB(128, 0, 0);
  503.    COLOR_RED := RGB(192, 0, 0);
  504.    COLOR_LTRED := RGB(255, 0, 0);
  505.    COLOR_DKGREEN := RGB(0, 128, 0);
  506.    COLOR_GREEN := RGB(0, 192, 0);
  507.    COLOR_LTGREEN := RGB(0, 255, 0);
  508.    COLOR_BLUEGREEN := RGB(0, 128, 128);
  509.    COLOR_OLIVE := RGB(128, 128, 0);
  510.    COLOR_DKBLUE := RGB(0, 0, 128);
  511.    COLOR_BLUE := RGB(0, 0, 255);
  512.    COLOR_CYAN := RGB(0, 255, 255);
  513.    COLOR_DKPURPLE := RGB(128, 0, 128);
  514.    COLOR_PURPLE := RGB(192, 0, 192);
  515.    COLOR_MAGENTA := RGB(255, 0, 255);
  516.    COLOR_LTYELLOW := RGB(255, 255, 0);
  517. end.
  518.